package enemies;


import java.util.LinkedList;
import java.util.List;

import mapControl.GraphicsMapControl;
import elementos.Player;
import enemies.factory.Barracks;
import enemies.factory.builders.AltairEnemyBuilder;
import enemies.factory.builders.EnemyBuilder;
import enemies.factory.builders.RugulusEnemyBuilder;
import enemies.factory.builders.SiruisEnemyBuilder;

/**
 * Clase que representa el set de enemigos que se moveran en el tablero
 * @author Sebastian Giulietti 69032 
 * @author Adrian Sanchez 64251
 */
public class Bad_Boys {

    private	List<Enemy> collectionEnemies;

	/**
	 * Contructor principal, crea las "barracas" y a los enemigos 
	 * que deambularan por el nivel
	 * @param mapControl
	 * @param player
	 */
	public Bad_Boys(GraphicsMapControl mapControl, Player player) {
		  
		Barracks barracks = new Barracks(mapControl, player);
		EnemyBuilder rugulusEnemyBuilder = new RugulusEnemyBuilder();
		EnemyBuilder altairEnemyBuilder = new AltairEnemyBuilder();
		EnemyBuilder siruisEnemyBuilder = new SiruisEnemyBuilder();

		collectionEnemies = new LinkedList<Enemy>();

		barracks.setEnemyBuilder(rugulusEnemyBuilder);

		barracks.construct();
		collectionEnemies.add(barracks.startAndGetEnemy());

		barracks.construct();
		collectionEnemies.add(barracks.startAndGetEnemy());

		barracks.construct();
		collectionEnemies.add(barracks.startAndGetEnemy());

		barracks.construct();
		collectionEnemies.add(barracks.startAndGetEnemy());

		barracks.setEnemyBuilder(altairEnemyBuilder);

		barracks.construct();
		collectionEnemies.add(barracks.startAndGetEnemy());

		barracks.construct();
		collectionEnemies.add(barracks.startAndGetEnemy());

		barracks.setEnemyBuilder(siruisEnemyBuilder);

		barracks.construct();
		collectionEnemies.add(barracks.startAndGetEnemy());

		for (Enemy e : collectionEnemies) {
			Thread t = new Thread(e);
			t.start();
		}

	}
	  
	/**Devuelve la coleccion de enemigos
	 * @return Coleccion de enemigos
	 */
	public List<Enemy> getCollectionEnemies() {
		return collectionEnemies;
	}

	/** Quita a un enemigo de la coleccion
	 * @param enemy enemigo
	 */
	public void quitarEnemy(Enemy enemy) {
		collectionEnemies.remove(enemy);
	}
}
